#冒泡排序
"""def bubble_Sort(obj, key=None, reverse=False):
    length = len(obj)
    # 外层循环用来确定找出剩余数据的最大值，N个数，找n-1次即可
    for i in range(length-1):
        for j in range(length-i-1):
            if key:
                if key(obj[j]) > key(obj[j + 1]):
                    obj[j], obj[j + 1] = obj[j + 1], obj[j]
            else:
                if obj[j] > obj[j+1]:
                    obj[j], obj[j+1] = obj[j+1], obj[j]
    if reverse:
        return obj[::-1]
    else:
        return obj"""


def bubble_sort(number_list):
    length=len(number_list)
    for i in range(0,length-1):
        for j in range(0,length-i-1):
           if number_list[j] > number_list[j+1]:
               number_list[j],number_list[j+1] = number_list[j+1],number_list[j]
           print(f"对比次数{j}",number_list)
    return number_list
